package ericXie.com.command 
{
	import com.adobe.cairngorm.commands.ICommand;
	import com.adobe.cairngorm.control.CairngormEvent;
	import ericXie.com.events.SimpleButtonAshyEvent;
	import flash.display.DisplayObject;
	
	/**
	 * ...处理SimpleButton的置灰皮肤状态，返回正常状态样式
	 * @author EricXie
	 */
	public class SimpleButtonAshyCommand implements ICommand 
	{
		
		public function SimpleButtonAshyCommand() 
		{
			
		}
		public function execute(event:CairngormEvent):void
		{
			var evt:SimpleButtonAshyEvent = event as SimpleButtonAshyEvent;
			if (evt.ashyBoolean)
			{
				if (!evt.simpleBn.enabled) {
					var sp:DisplayObject=evt.simpleBn.upState
					evt.simpleBn.upState = evt.simpleBn.hitTestState;
					evt.simpleBn.hitTestState = sp;
					evt.simpleBn.enabled = true;
					evt.simpleBn.mouseEnabled = true;
					//sp = null;
				}
			}else {
				if (evt.simpleBn.enabled)
				{
					var sp1:DisplayObject=evt.simpleBn.upState
					evt.simpleBn.upState = evt.simpleBn.hitTestState;
					evt.simpleBn.hitTestState = sp1;
					evt.simpleBn.enabled = false;
					evt.simpleBn.mouseEnabled = false;
					//sp1 = null;
				}
			}
		}
		
	}

}